package operation;

import book.BookList;

import java.util.Scanner;

public class ReturnOperation implements Operation {
    public void work(BookList list) {
        System.out.println("归还图书...");
        System.out.println("请输入要归还的书名：");
        Scanner sc = new Scanner(System.in);
        String borrowName = sc.nextLine();
        int currentsize = list.getSizeUsed();
        for (int i = 0; i < currentsize; i++) {
            if (borrowName.equals(list.getBook(i).getBookName())) {
                list.getBook(i).setBorrowed(false);
                System.out.println("归还成功！！！");
                return;
            }
        }
        System.out.println("没有找到这本书!!!");
    }
}
